Using the Advanced Picture Object

The Advanced Pictureobject in Advanced Process Automation enables you to capture text from images using the Optical Recognition Method (OCR). The Advanced Pictureobject uses an Advanced OCR engine.

You can capture text from images (JPG, BMP, TIFF, GIF), or user interfaces of remote applications that are running (for example, Citrix sessions).

To capture text, images must have a resolution of at least 200 dpi, with a contrast of 50% brightness or more.

Each picture being loaded cannot be larger than 2GB.

OCR functionality is included in the Advanced Picture object, which can be found in the Connectivity.OCR.

The following languages are supported: Arabic, Armenian, Azeri, Bashkir, Bulgarian, Catalan, Chinese (Simplified and Traditional), Croatian, Czech, Danish, Dutch, Estonian, English, Farsi, Finnish, Dutch, French, German, Greek, Hebrew, Hungarian, Indonesian, Italian, Japanese, Korean, Latin, Latvian, Lithuanian, Norwegian, Polish, Portuguese, Romanian, Russian, Slovak, Slovenian, Spanish, Swedish, Tatar, Thai, Turkish, Ukrainian, Vietnamese.

Advanced Picture Object Functionality

You can review the available functions of the Advanced Pictureobject from the Connectivity.OCR library in the Real-Time Designer.

To view the Connectivity.OCR Library functionality:

  1. In Real-Time Designer, open the Projecttab.

  2. Under the Referencessection, expand the Library References node, and select Connectivity.OCR.

  3. Open the Functionalitytab, and from the Typedrop-down list, select Advanced Picture.

The following properties are available:

Property

Description

Block Count

The number of OCR blocks in the image.

Handwriting Identification Mode

The name of the handwriting style of the text, passed as in input to the OCR engine to improve text recognition. Relevant only when OCR Mode is set to Handwriting.

Height

The height of the image in pixels.

Languages

The expected language(s) of the text, passed as in input to the OCR engine to improve text recognition. The default is English.

OCR Mode

The OCR mode to be used by the OCR engine.

Tables Count

The number of the recognized tables in an Advanced Picture object. This property gets the number of tables only after the table's data recognition. First run the function to get the text from the table by using the known index of the table in advance.

Width

The width of an Advanced Picture object (in pixels).

The following functions are available:

Function

Description

Get Word Locations

Gets a list of coordinates of the rectangles that enclose the given word. This is new from version 7.2.

Save

Saves an Advanced Picture as an image file according to specified full path.

Determine Control Brightness

Determines a brightness value in percentages of a given Screen Element or VSD Control (value 100 is white).

Create from File

Creates an Advanced Picture from the specified image file. Requires the full path to the file, for example: C:\Data\myImage.jpg

Create from Clipboard

Creates an Advanced Picture from the clipboard.

Copy to Clipboard

Copy the image in the Advanced Picture Object to the Windows clipboard

Compare

Compares two Advanced Picture objects. Returns true if both images are the same, and false if not.

Create from Window

Capture a screenshot of a window specified by its window handle and load that image into the Advanced Picture Object.The specified window is activated and brought to front before the screenshot is captured.

Rotate

Rotate the image stored in the Advanced Picture Object clockwise by the specified angle.

Set Languages

Set the expected language(s) of the image text to improve character recognition.

Set OCR Mode

Sets the OCR mode used by the OCR engine.

If the Default option does not work, you can try one of the following options:

Text (Speed): Use this option for a text document where speed is important. Faster than Text(Accuracy), but potentially less exact.

Text (Accuracy): Use this option for a text document where accuracy is important. Slower than Text(Speed), but potentially more exact.

Document (Speed): Use this option for a text document with objects such as tables where speed is important. Faster than Document(Accuracy), but potentially less exact.

Document (Accuracy): Use this option for a text document with objects such as tables where accuracy is important. Slower than Document(Speed), but potentially more exact.

Barcode (Speed): Use this option for a barcode where accuracy is important. Slower than Barcode(Speed), but potentially more exact.

Barcode (Accuracy): Use this option for a barcode where accuracy is important. Slower than Barcode(Speed), but potentially more exact.

Business Cards: Use this option for business cards.

Engineering Drawings: Use this option for drawings and charts.

One Block: Also called Field Level Recognition. Use this to OCR a single block on the screen. Use this option together controls or with crop functions to demarcate the block.

Handwriting:Use this option for handwritten content. For the Handwriting option, you can choose between different handwriting styles. Select Handwriting, and then the style. Hover over a style to see a tooltip with a description.

Get Image Text

Retrieve the text from the image. All the text in the image is returned as a single text value.

Get Text Color

Retrieve the color of the text in an image. Returns the color as text in RGB format, for example, 34,177,176. Intended for cases in which all text is of same color and on a white background.

Get OCR Text Block

Retrieve the text from a specified block in the image. The first block in the image is numbered 1. All the text in the block is returned as a single text value. To retrieve each word in the block individually, use Get Words from Block.

Get Suspicious Data

Retrieve all instances of suspicious data in the image. Optionally check suspicious words against a dictionary.

Get Words

Retrieve all words individually from the image.

Get Word Locations

Retrieve a list of all locations of a specified word in the image. The locations are returned as Screen Element Rectangle objects.

Get Block Words

Retrieve all words individually from a specified block in the image. The first block in the image is numbered 1. To retrieve all words in the block as a single text element, use Get Text from Block.

Recognize Text from Control

Captures image from VSD Control or Screen Element as Advanced Picture object and retrieves text. During the capture, it brings control into the foreground.

Get Control Image

Captures image from VSD Control or Screen Element and retrieves a new Advanced Picture object.

Crop Image

Use with the Assign function to load a cropped section of the image in the Advanced Picture Object into another Advanced Picture Object. The area to crop to is specified by a Screen Rectangle Object.

Get Difference From Template

Measure how similar the image in the Advanced Picture Object is to the image in another Advanced Picture Object. Returns a decimal ranging from 100 (identical) to 0 (very different). Typical use case is to compare the contents of a checkbox on a customer's form to a filled checkbox on a prepared template form.

Determine Brightness

Measure the brightness of a specified rectangle of the Advanced Picture Object. Returns a decimal ranging from 0 (white) to 100 (black).

Get Checkmark State

Retrieve the state of the checkbox in a specified rectangle in the image. Specify whether the checkbox shape is square or round. Returns a text value: Checked, NotChecked, Corrected (was checked but then corrected), or Not Recognized. If OCR is not installed, NotDetected is returned.

Get Table Cells Text

Retrieve all text from a specified table in the image. The first table in the image is numbered 1. Returns a list of text, where each element of the list stores the text from one cell of the table.

Get Table Cells Rectangle

Retrieve the locations of all cells in a specified table. The first table in the image is numbered 1. Returns a list of screen element rectangle objects, where each rectangle specifies the location of one cell.

Get Table

Retrieve all text from a specified table in the image. The first table in the image is numbered 1. Returns a list of rows, where each element of a row stores the text from the corresponding cell of the table.

The following Scene Composer functions are available:

Control

Function

Description

PictureBox

Get Advanced Picture

Returns an Advanced Picture object from a scene with PictureBox of Windows control.

DataCapture

Capture Advanced Images

Returns Advanced Picture objects collection from a scene with DataCapture of General control. The IncludeImages property must be True.